#!/usr/bin/env python

    
import argparse

ap= argparse.ArgumentParser(description='rf test')
ap.add_argument('file', help='input file')
# ap.add_argument('sub', nargs='?', help='sub')
ap.add_argument('-p', '--prefix', help='out prefix', default='1')
ap.add_argument('-s', '--sep', help='sep', default='\t')
ap.add_argument('-n', '--names', help='row as header', default=1, type=int)
ap.add_argument('-i', '--index', help='col as index', default=1, type=int)
# ap.add_argument('-r', '--rename', help='False default', action="store_true")
args= ap.parse_args()

from rf.mlutil import join, read, write


    
def trans(i,):
    i = i -1
    if  i < 0:
        return None
    return i

df = read(args.file, header=trans(args.names), index_col=trans(args.index), sep=args.sep)
out = join([args.prefix, '.txt'], sep='')
write(df, out)